home *** CD-ROM | disk | FTP | other *** search
/ Aminet 16 / Aminet 16 (1996)(GTI - Schatztruhe)[!][Dec 1996].iso / Aminet / util / batch / random.lha / Game.bat next >
DOS Batch File  |  1996-09-17  |  1KB  |  61 lines

  1. ;This is a simple AmigaDOS script file that combines the RequestChoice
  2. ;command found with WB2.1+ and the Random command that I wrote to create a
  3. ;stunningly interesting & enjoyable game!
  4.  
  5. Lab Start
  6.  
  7. ; Set number of guesses to 0
  8.  
  9. Echo "0" >ENV:Guesses
  10.  
  11. ; Pick a number between 1 and 10
  12.  
  13. Random 10 >ENV:RanNum
  14.  
  15. Lab Get_Guess
  16. ; Ask user what they think it is
  17.  
  18. RequestChoice >ENV:Choice "$Guesses guess(es) so far" "Pick a number, any number" "1|2|3|4|5|6|7|8|9|10"
  19. Eval >ENV:G2 $Guesses + 1
  20. Echo >ENV:Guesses $G2
  21.  
  22. If $Choice EQ "0"
  23.  
  24.    Echo "10" >ENV:Choice
  25.  
  26. EndIf
  27.  
  28. If VAL $Choice EQ $RanNum
  29.  
  30. ; They got it right!
  31.  
  32.    RequestChoice >ENV:Again "Well done!" "You got it in $Guesses!*nDo you want another go?" "Go on then|Get lost!"
  33.    If $Again EQ "1"
  34.  
  35.      Skip Start BACK
  36.  
  37.    Else
  38.  
  39.       Delete >NIL: ENV:Guesses QUIET FORCE
  40.       Delete >NIL: ENV:RanNum QUIET FORCE
  41.       Delete >NIL: ENV:Choice QUIET FORCE
  42.       Delete >NIL: ENV:G2 QUIET FORCE
  43.       Delete >NIL: ENV:Again QUIET FORCE
  44.  
  45.    EndIf
  46.  
  47. Else
  48.  
  49.    If VAL $Choice GT $RanNum
  50.  
  51.       RequestChoice >NIL: "Ooooh, nearly ..." "That's too high!" "Doh!"
  52.  
  53.    Else
  54.  
  55.       RequestChoice >NIL: "Ooooh, nearly ..." "That's too low!" "Doh!"
  56.  
  57.    EndIf
  58.    Skip Get_Guess BACK
  59.  
  60. EndIf
  61.